#ifndef CONVERSE_CONVERSEPHOTOMESSAGE_H
#define CONVERSE_CONVERSEPHOTOMESSAGE_H

#include "converseabstractmessage.h"

#include <QObject>
#include <QPixmap>


namespace Converse {

class AbstractConversation;
class PhotoMessage : public Converse::AbstractMessage
{
    Q_OBJECT
public:
    explicit PhotoMessage(qint64 id,
                          qint64 sendingId,
                          const AbstractConversation &conversation,
                          qint64 createdTime,
                          qint64 receivedTime,
                          int32_t senderId,
                          qint64 receiverId,
                          const QString &url,
                          QObject *parent = 0);

    virtual ~PhotoMessage();

private:
    QString m_url;
    QString m_textMessage;
    QPixmap m_pixmap;
    QString m_format;
    QString m_photoId;
    QString m_tempFile;

    // store default photo path or temp file path
    QString m_localPath;

    bool m_isAccepted;
    bool m_isRejected;
    bool m_isCancel;
    
public:
    inline const QString &url() const {
        return m_url;
    }

    inline const QPixmap &photo() const {
        return m_pixmap;
    }

    inline void setPhoto(const QPixmap &photo) {
        m_pixmap = photo;
    }

    inline const QString &fomat() const {
        return m_format;
    }

    inline void setFomat(const QString &fomat) {
        m_format = fomat;
    }

    inline const QString &photoId() const {
        return m_photoId;
    }

    inline void setPhotoId(const QString &id) {
        m_photoId = id;
    }

    inline void setAcceptedState(bool state) {
        m_isAccepted = state;
    }

    inline bool isAccepted() const {
        return m_isAccepted;
    }

    inline void setRejectState(bool state) {
        m_isRejected = state;
    }

    inline bool isRejected() const {
        return m_isRejected;
    }

    inline void setCancelState(bool state) {
        m_isCancel = state;
    }

    inline bool isCancel() const {
        return m_isCancel;
    }

    inline void setTempFile(const QString &file) {
        m_tempFile = file;
    }

    inline const QString &tempFile() const {
        return m_tempFile;
    }

    inline void setLocalPath(const QString &path) {
        m_localPath = path;
    }

    inline const QString &localPath() const {
        return m_localPath;
    }

public:
    void setAcceptedState();
    void setRejectState();
    void setCancelState();

public:
    const QString &message() const;
    AbstractMessage::Type type() const;
    QVariant extra() const;
};

}
#endif // CONVERSE_CONVERSEPHOTOMESSAGE_H
